package com.yhsimon.realm.member.exception;

import com.yhsimon.realm.member.constant.ResultCodeEnum;
import lombok.Data;

@Data
public class RealmException extends RuntimeException {
    private Integer code;          // 错误状态码
    private String message;        // 错误消息
    private ResultCodeEnum resultCodeEnum;     // 封装错误状态码和错误消息

    public RealmException(ResultCodeEnum resultCodeEnum) {
        this.resultCodeEnum = resultCodeEnum;
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMessage();
    }

    public RealmException(String code,String message) {
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMessage();
    }
}
